package com.gxuwz.mapper;

import com.gxuwz.model.entity.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CourseMapper {
    /*查询课程信息*/
    @Select("select * from sys_course where courseID=#{courseID}")
    Course selectCourseByCourseID(String courseID);
    @Select("select * from sys_course where courseName=#{courseName}")
    Course selectCourseByCourseName(String courseName);

    /*修改课程信息*/
    @Update("UPDATE sys_course SET classID = #{classID}, courseName = #{courseName}, term = #{term}  WHERE courseID = #{courseID}")
    int updateCourse(Course course);

    /*添加课程*/
    @Insert("INSERT INTO sys_course (courseID, classID, courseName, year, term, hour) VALUES (#{courseID}, #{classID}, #{courseName}, #{year}, #{term}, #{hour})")
    int insertCourse(Course course);

    /*删除课程*/
    @Delete("DELETE FROM sys_course WHERE courseID = #{courseID}")
    int deleteCourseByCourseID(String courseID);

    /*查询所有课程信息*/
    @Select("select * from sys_course")
    List<Course> getAllCourse();
}

